package com.union.core.information.service;

import java.util.List;

import org.apache.log4j.Logger;

import com.union.core.information.dao.impl.KnowledgeManageDaoImpl;
import com.union.core.information.model.KnowledgeManage;

/**
 * 服务类: 知识管理
 * filename: KnowledgeManageService.java
 * project:  union
 * @company Hainan Jowe Technology Ltd
 * @author Harry Zhang
 * @create in 2012-11-05
 * @version 1.0
 */
public class KnowledgeManageService {
	private static Logger log = Logger.getLogger(KnowledgeManageService.class.getName());
	KnowledgeManageDaoImpl knowledgeMDI;
	public KnowledgeManageService(){
		knowledgeMDI=new KnowledgeManageDaoImpl();
	}
	public boolean addKnowledgeManage(KnowledgeManage knowledgeManage) {
		boolean bl=knowledgeMDI.addKnowledge(knowledgeManage);
		log.info("添加公会知识"+knowledgeManage.getKnowledge_title());
		return bl;
	}

	public boolean delKnowledgeManage(int id) {
		boolean bl=knowledgeMDI.delKnowledge(id);
		log.info("删除公会知识id："+id);
		return bl;
	}

	public List<KnowledgeManage> queryKnowledgeManageList(int id,String knowledgeTitle,String knowledgeContent, 
			String releaseName,String releaseTime,int organizationId,int personId,String organizationName,
			String startDate,String endDate,String paraName,String paraVal,String orderBy,int start,int pagecount) {
		List<KnowledgeManage> KnowledgeManageList=knowledgeMDI.queryList(id, knowledgeTitle, knowledgeContent, releaseName,
					releaseTime, organizationId, personId, organizationName,startDate,endDate, paraName, paraVal, orderBy, 
					start, pagecount);
			log.info("查询公会知识列表");
		return KnowledgeManageList;
	}
	public int queryKnowledgeManageListCount(int id,String knowledgeTitle,String knowledgeContent, 
			String releaseName,String releaseTime,int organizationId,int personId,String organizationName,
			String startDate,String endDate,String paraName,String paraVal) {
			int count=knowledgeMDI.queryListCount(id, knowledgeTitle, knowledgeContent, releaseName, 
					releaseTime, organizationId, personId, organizationName,startDate,endDate, paraName, paraVal);
			log.info("查询公会知识记录数为"+count);
		return count;
	}
	public boolean editKnowledge(KnowledgeManage knowledgeManage) {
		boolean bl=false;
		bl=knowledgeMDI.editKnowledge(knowledgeManage);
		log.info("更新公会知识记录ID="+knowledgeManage.getId()+"更新人："+knowledgeManage.getEdit_name());
		return bl;
	}
	public KnowledgeManage queryById(int id) {
		KnowledgeManage knowledgeManage=knowledgeMDI.queryById(id);
		log.info("查询公会知识单条记录id为："+id);
		return knowledgeManage;
	}
}
